package com.czk.scala.chapter06

/**
 * 类的继承
 *
 * @Author:ChenZhangKun
 * @Date: 2022/1/6 17:51
 */
object Test04_Access {
  def main(args: Array[String]): Unit = {
    val person: Person = new Person
    // 访问属性
    println(person.sex)

    // 定义子类
    val worker: Worker = new Worker

    worker.printInfo()


  }
}

class Worker extends Person {
  override def printInfo(): Unit = {
    println(s"Worker($name,$age)")
  }
}
